// by Xeno
#define THIS_FILE "x_lockc.sqf"
#include "x_setup.sqf"
private ["_vec", "_arg","_id"];

PARAMS_1(_vec);
_id = _this select 2;
_arg = _this select 3;

if (vehicle player != player) exitWith {
	systemChat (localize "STR_DOM_MISSIONSTRING_274")
};

if (_arg == 0 && {(_vec call d_fnc_isVecLocked)}) exitWith {systemChat (localize "STR_DOM_MISSIONSTRING_275")};

if (_arg == 1 && {!(_vec call d_fnc_isVecLocked)}) exitWith {systemChat (localize "STR_DOM_MISSIONSTRING_276")};

_depl = GV(_vec,GVAR(MHQ_Deployed));
if (_arg == 1 && {!isNil "_depl"} && {_depl}) exitWith {
	systemChat (localize "STR_DOM_MISSIONSTRING_277");
};

if (_arg == 0 && {count (crew _vec) > 0}) then {{_x action ["Eject", vehicle _x]} forEach ((crew _vec) - [player])};

switch (_arg) do {
	case 0: {[QGVAR(l_v), [_vec, true]] call FUNC(NetCallEventCTS); systemChat (localize "STR_DOM_MISSIONSTRING_278")};
	case 1: {[QGVAR(l_v), [_vec, false]] call FUNC(NetCallEventCTS); systemChat (localize "STR_DOM_MISSIONSTRING_279")};
};

GVAR(adm_currentvec) = objNull;
_vec removeAction _id;
GVAR(admin_idd) =  -9999;
